import { createApp } from 'vue'
import App from './App.vue'
import 'element-plus/dist/index.css'
import 'devextreme/dist/css/dx.light.css';
import './assets/theme.css'; // 添加这一行引入自定义主题
import router from './router'
import { createPinia } from 'pinia'
import { registerMicroApps, start } from 'qiankun';
const pinia = createPinia()
const app = createApp(App)
registerMicroApps([
    {
        name: "sub-react", // 子应用的名称
        entry: '//localhost:3001', // 默认会加载这个路径下的html，解析里面的js
        activeRule: "/sub-react", // 匹配的路由
        container: "#sub-app" // 加载的容器
    },
    {
        name: "sub-vue", // 子应用的名称
        entry: '//localhost:3002', // 默认会加载这个路径下的html，解析里面的js
        activeRule: "/sub-vue", // 匹配的路由
        container: "#sub-app" // 加载的容器
    },
    {
        name: "sub-umi", // 子应用的名称
        entry: '//localhost:3003', // 默认会加载这个路径下的html，解析里面的js
        activeRule: "/sub-umi", // 匹配的路由
        container: "#sub-app" // 加载的容器
    }
],
    {
    // 微应用生命周期钩子
    beforeLoad: (app) => {
        console.log('[LifeCycle] before load %c%s', 'color: green;', app.name)
        return Promise.resolve()
    },
    beforeMount: (app) => {
        console.log('[LifeCycle] before mount %c%s', 'color: green;', app.name)
        return Promise.resolve()
    },
    afterUnmount: (app) => {
        console.log('[LifeCycle] after unmount %c%s', 'color: green;', app.name)
        return Promise.resolve()
    }
});
start({
    sandbox: {
        // 配置沙箱
        strictStyleIsolation: true, // 严格的样式隔离
        experimentalStyleIsolation: true // 实验性的样式隔离
    },
    prefetch: true // 开启预加载
})
app.use(router)
app.use(pinia)
app.mount('#app')